/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.vfi.be;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "VFI_DETALLE_TRANSACCION")
@NamedQueries({@NamedQuery(name = "DetalleTransaccion.findAll", query = "SELECT d FROM DetalleTransaccion d"), @NamedQuery(name = "DetalleTransaccion.findByIdDetalleTransaccion", query = "SELECT d FROM DetalleTransaccion d WHERE d.idDetalleTransaccion = :idDetalleTransaccion"), @NamedQuery(name = "DetalleTransaccion.findByMonto", query = "SELECT d FROM DetalleTransaccion d WHERE d.monto = :monto")})
public class DetalleTransaccion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_DETALLE_TRANSACCION", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idDetalleTransaccion;
    @Basic(optional = false)
    @Column(name = "MONTO", nullable = false, precision = 18, scale = 2)
    private BigDecimal monto;
    @JoinColumn(name = "FID_VFI_TIPO_TRANSACCION", referencedColumnName = "ID_TIPO_TRANSACCION", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private TipoTransaccion fidVfiTipoTransaccion;
    @JoinColumn(name = "FID_VFI_TRANSACCION", referencedColumnName = "ID_TRANSACCION", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private TranFinanciera fidVfiTransaccion;

    public DetalleTransaccion() {
    }

    public DetalleTransaccion(Long idDetalleTransaccion) {
        this.idDetalleTransaccion = idDetalleTransaccion;
    }

    public DetalleTransaccion(Long idDetalleTransaccion, BigDecimal monto) {
        this.idDetalleTransaccion = idDetalleTransaccion;
        this.monto = monto;
    }

    public Long getIdDetalleTransaccion() {
        return idDetalleTransaccion;
    }

    public void setIdDetalleTransaccion(Long idDetalleTransaccion) {
        this.idDetalleTransaccion = idDetalleTransaccion;
    }

    public BigDecimal getMonto() {
        return monto;
    }

    public void setMonto(BigDecimal monto) {
        this.monto = monto;
    }

    public TipoTransaccion getFidVfiTipoTransaccion() {
        return fidVfiTipoTransaccion;
    }

    public void setFidVfiTipoTransaccion(TipoTransaccion fidVfiTipoTransaccion) {
        this.fidVfiTipoTransaccion = fidVfiTipoTransaccion;
    }

    public TranFinanciera getFidVfiTransaccion() {
        return fidVfiTransaccion;
    }

    public void setFidVfiTransaccion(TranFinanciera fidVfiTransaccion) {
        this.fidVfiTransaccion = fidVfiTransaccion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetalleTransaccion != null ? idDetalleTransaccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleTransaccion)) {
            return false;
        }
        DetalleTransaccion other = (DetalleTransaccion) object;
        if ((this.idDetalleTransaccion == null && other.idDetalleTransaccion != null) || (this.idDetalleTransaccion != null && !this.idDetalleTransaccion.equals(other.idDetalleTransaccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.DetalleTransaccion[idDetalleTransaccion=" + idDetalleTransaccion + "]";
    }

}
